package com.yfp.operation.controller;

import com.yfp.common.core.domain.R;
import com.yfp.common.core.web.controller.BaseController;
import com.yfp.operation.domain.MiniJingang;
import com.yfp.operation.service.MiniJingangService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 
 * @version 1.0
 * @date 2024-12-17 16:02
 */
@RestController
@RequestMapping("/miniJinGang")
@Tag(name = "金刚区")
public class MiniJingangController extends BaseController {

    @Resource
    private MiniJingangService miniJingangService;



    @GetMapping("/list")
    @Operation(summary = "金刚区列表")
    public R<List<MiniJingang>> miniJinGangList(){
        return R.ok(miniJingangService.miniJinGangList());
    }


    @PostMapping("/add")
    @Operation(summary = "新增金刚区功能")
    public R<?> add(@RequestBody MiniJingang miniJingang){
        miniJingangService.add(miniJingang);
        return R.ok();
    }


    @PostMapping("/update")
    @Operation(summary = "修改金刚区功能")
    public R<Void> update(@RequestBody MiniJingang miniJingang){
        return miniJingangService.updateJinGang(miniJingang);
    }


    @DeleteMapping("/delete")
    @Operation(summary = "删除金刚区功能")
    public R<?> deleteJinGang(@RequestParam("id") Long id) {
        miniJingangService.deleteJinGang(id);
        return R.ok();
    }


    @PostMapping("/sort")
    @Operation(summary = "金刚区排序")
    public R<List<MiniJingang>> sort(@RequestBody List<MiniJingang> list){
        return R.ok(miniJingangService.sort(list));
    }

}
